<template>
	<view class="lognInfo">
		<view class="title">
			<image :src="userInfo.avatarUrl" mode=""></image>
			<text>{{userInfo.nickName}}</text>
		</view>
		<view class="bottom">
			<button @click="getLogout">退出登录</button>
		</view>
	</view>
</template>
<script>
	import { mapState } from 'vuex'
	export default {
		computed : {
			...mapState('user',['userInfo'])
		},
		methods : {
			async getLogout() {
				let [err,suc] = await uni.showModal({
					title:'提示',
					content: '是否退出登录'
				})
				if(suc.confirm) {
					this.$store.commit('user/getUserInfo',{})
					this.$store.commit('user/getToken',undefined)
				}
			}
		}
	}
</script>
<style>
</style>
